package com.wmx.hello;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * HelloWorld 控制层
 *
 * @author wangMaoXiong
 * @version 1.0
 * @date 2021/11/14 11:15
 */
@RestController
public class HelloWorldController {

    @Resource
    private HelloService helloService;

    /**
     * http://127.0.0.1:80/hello/sayHello?msg=你好，蚩尤后裔
     *
     * @param msg
     * @return
     */
    @GetMapping("hello/sayHello")
    public Map<String, Object> sayHello(@RequestParam String msg) {
        Map<String, Object> dataMap = new HashMap<>(8);
        dataMap.put("code", 200);
        dataMap.put("msg", "success");
        dataMap.put("data", helloService.sayHello(msg));
        return dataMap;
    }


}
